package kr.hkit.BusinessManagement.UI;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

import kr.hkit.BusinessManagement.BasicDataMgnUI.PanelBusinessEmpMgn;
import kr.hkit.BusinessManagement.BasicDataMgnUI.PanelProductMgn;
import kr.hkit.BusinessManagement.ViewUI.FrameBusinessEmpLists;
import kr.hkit.BusinessManagement.ViewUI.FrameProductLists;



public class BusinessManagementMain extends JFrame implements ActionListener {

	private JPanel contentPane;
	private JMenu mnBasicDataManagement;
	private JMenu mnSaleManagement;
	private JMenu mnQuery;
	private JMenuItem mntmNewMenuItem_4;

	private JFrame frame;
	private JMenuItem mntmNewMenuItem_1;
	private JMenuItem mntmNewMenuItem_5;
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					BusinessManagementMain frame = new BusinessManagementMain();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public BusinessManagementMain() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		
		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);
		
		mnBasicDataManagement = new JMenu("기초자료관리");
		menuBar.add(mnBasicDataManagement);
		
		JMenuItem mntmNewMenuItem = new JMenuItem("영업사원관리");
		mntmNewMenuItem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				contentPane.removeAll();
				contentPane.add(new PanelBusinessEmpMgn());
				contentPane.revalidate();
			}
		});
		mnBasicDataManagement.add(mntmNewMenuItem);
		
		mntmNewMenuItem_1 = new JMenuItem("제품관리");
		mntmNewMenuItem_1.addActionListener(this);
		mnBasicDataManagement.add(mntmNewMenuItem_1);
		
		JMenuItem mntmNewMenuItem_2 = new JMenuItem("거래처관리");
		mnBasicDataManagement.add(mntmNewMenuItem_2);
		
		mnSaleManagement = new JMenu("판매관리");
		menuBar.add(mnSaleManagement);
		
		JMenuItem mntmNewMenuItem_3 = new JMenuItem("판매관리");
		mnSaleManagement.add(mntmNewMenuItem_3);
		
		mnQuery = new JMenu("조회업무");
		menuBar.add(mnQuery);
		
		mntmNewMenuItem_4 = new JMenuItem("영업사원현황");
		mntmNewMenuItem_4.addActionListener(this);
		mnQuery.add(mntmNewMenuItem_4);
		
		mntmNewMenuItem_5 = new JMenuItem("제품현황");
		mntmNewMenuItem_5.addActionListener(this);
		mnQuery.add(mntmNewMenuItem_5);
		
		JMenuItem mntmNewMenuItem_6 = new JMenuItem("거래처현황");
		mnQuery.add(mntmNewMenuItem_6);
		
		JMenuItem mntmNewMenuItem_7 = new JMenuItem("거래처별 거래 현황");
		mnQuery.add(mntmNewMenuItem_7);
		
		JMenuItem mntmNewMenuItem_8 = new JMenuItem("제품별 거래 현황");
		mnQuery.add(mntmNewMenuItem_8);
		
		JMenuItem mntmNewMenuItem_9 = new JMenuItem("영업사원별 거래 현황");
		mnQuery.add(mntmNewMenuItem_9);
		
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
	}

	public void actionPerformed(ActionEvent arg0) {
		if (arg0.getSource() == mntmNewMenuItem_5) {
			actionPerformedMntmNewMenuItem_5(arg0);
		}
		if (arg0.getSource() == mntmNewMenuItem_1) {
			actionPerformedMntmNewMenuItem_1(arg0);
		}
		if (arg0.getSource() == mntmNewMenuItem_4) {
			actionPerformedMntmNewMenuItem_4(arg0);
		}
	}
	protected void actionPerformedMntmNewMenuItem_4(ActionEvent arg0) {
		FrameBusinessEmpLists businessEmpListframe = new FrameBusinessEmpLists();
		businessEmpListframe.setVisible(true);
	}
	protected void actionPerformedMntmNewMenuItem_1(ActionEvent arg0) {
		contentPane.removeAll();
		contentPane.add(new PanelProductMgn());
		contentPane.revalidate();
	}
	protected void actionPerformedMntmNewMenuItem_5(ActionEvent arg0) {
		FrameProductLists productListFrame = new FrameProductLists();
		productListFrame.setVisible(true);
	}
}
